package com.msb.mall.product.entity;
import com.msb.common.exception.groups.AddGroupsInterface;
import com.msb.common.exception.groups.UpdateGroupsInterface;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.msb.common.validator.ListValue;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author xxf
 * @email 1983752950@qq.com
 * @date 2022-09-10 22:42:29
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	//不知道怎么回事这两个包导不进来，只能下面这样导入
	@Null(message = "添加品牌必须为空",groups = {AddGroupsInterface.class})
	@NotNull(message = "更新品牌id必须不为空",groups = {UpdateGroupsInterface.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */

	@NotBlank(message = "品牌不能为空",groups = {AddGroupsInterface.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "Logo不能为空",groups = {AddGroupsInterface.class})
	@URL(message = "Logo添加必须满足url地址",groups = {AddGroupsInterface.class, UpdateGroupsInterface.class})
	private String logo;
	/**
	 * 介绍
	 *
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull( message = "显示状态不能为空",groups = {AddGroupsInterface.class, UpdateGroupsInterface.class})
	@ListValue(val ={1,0} ,groups = {AddGroupsInterface.class,UpdateGroupsInterface.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空",groups = {AddGroupsInterface.class})
	@Pattern(regexp="^[a-zA-Z]$",message = "检索首字母必须是单个的字母",groups = {AddGroupsInterface.class, com.msb.common.exception.groups.UpdateGroupsInterface.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序不能为null",groups = {AddGroupsInterface.class})
	@Min(value = 0,message = "排序不能小于0",groups = {AddGroupsInterface.class, UpdateGroupsInterface.class})
	private Integer sort;

}
